﻿<%@ Page Title="Log In" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeBehind="TU_User.aspx.cs" Inherits="JOIN.Rights.Apps.TU_User" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
    <script src="../Scripts/editPage.js" type="text/javascript"></script>
    <script src="../Scripts/inherit.js" type="text/javascript"></script>
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <!-- Add.aspx -->
    <ajaxToolkit:ToolkitScriptManager ID="scriptmanager1" runat="server" />
    <table cellspacing="0" cellpadding="0" width="100%" border="0" class="InputTable">
        <tr>
            <td height="25" width="30%" align="right" class="InputLabel">
                用户ID：
            </td>
            <td height="25" width="*" align="left">
                <asp:TextBox ID="txtUserID" runat="server" />
            </td>
            <td height="25" width="30%" align="right" class="InputLabel">
                用户帐号：
            </td>
            <td height="25" width="*" align="left">
                <asp:TextBox ID="txtUserNO" runat="server" />
            </td>
        </tr>
        <tr>
            <td height="25" width="30%" align="right" class="InputLabel">
                用户密码：
            </td>
            <td height="25" width="*" align="left">
                <asp:TextBox ID="txtUserPwd" runat="server" />
            </td>
            <td height="25" width="30%" align="right" class="InputLabel">
                用户姓名：
            </td>
            <td height="25" width="*" align="left">
                <asp:TextBox ID="txtUserName" runat="server" />
            </td>
        </tr>
        <tr>
            <td height="25" width="30%" align="right" class="InputLabel">
                性别：
            </td>
            <td height="25" width="*" align="left">
                <asp:TextBox ID="txtUserSex" runat="server" />
            </td>
            <td height="25" width="30%" align="right" class="InputLabel">
                联系电话：
            </td>
            <td height="25" width="*" align="left">
                <asp:TextBox ID="txtUserPhone" runat="server" />
            </td>
        </tr>
        <tr>
            <td height="25" width="30%" align="right" class="InputLabel">
                住址：
            </td>
            <td height="25" width="*" align="left" colspan="2">
                <asp:TextBox ID="txtUserAddress" runat="server" />
            </td>
            
        </tr>
        <tr>
            <td height="25" width="30%" align="right" class="InputLabel">
                所属企业：
            </td>
            <td height="25" width="*" align="left" colspan="2">
                <Kevin:CodeNameSelect ID="cns_CompanyID" runat="server" ServicePath="~/Services/CodeNameService.asmx"
                    ServiceMethod="GetCompany" MinimumPrefixLength="0" />
            </td>
            <td height="25" width="30%" align="right" class="InputLabel">
                电子邮件：
            </td>
            <td height="25" width="*" align="left">
                <asp:TextBox ID="txtUserEmail" runat="server" />
            </td>
        </tr>
        <tr>
            <td height="25" width="30%" align="right" class="InputLabel">
                帐号状态(0:正常使用,1:锁定)：
            </td>
            <td height="25" width="*" align="left">
                <asp:TextBox ID="txtUserState" runat="server" />
            </td>
            <td height="25" width="30%" align="right" class="InputLabel">
                角色：
            </td>
            <td>
                <Kevin:CodeNameSelect ID="cns_Roles" runat="server" ServicePath="~/Services/CodeNameService.asmx"
                    ServiceMethod="GetRoles" MinimumPrefixLength="0" MutiSelecte=true />
            </td>
        </tr>
        <tr>
            <td colspan="4" align="center">
                <input id="btnSave" value="保存" type="button" class="btn" />&nbsp;&nbsp;<input id="btnDel"
                    value="删除" type="button" class="btn" />
                    <asp:Button ID="btnTest" runat="server" Text="test" />
            </td>
        </tr>
    </table>
    <div>
    </div>
    <Kevin:DataBind ID="databind1" runat="server" ServicePath="~/Services/BLLService.asmx"
        ServiceMethod="UserService" ClientDataBind="true">
        <CommandItems>
            <Kevin:CommandItem ControlID="btnSave" CommandType="Save" ServiceMethod="UserService"
                CallbackMethod="userSetData" />
            <Kevin:CommandItem ControlID="btnDel" CommandType="Del" ServiceMethod="UserService"
                OnOperationPre="delconfirm" CallbackMethod="$editPage.close" />
        </CommandItems>
        <BindItems>
            <Kevin:DataBindItem ControlID="txtUserID" DataPropertyName="UserID" IsPrimary="true" />
            <Kevin:DataBindItem ControlID="txtUserNO" DataPropertyName="UserNO" />
            <Kevin:DataBindItem ControlID="txtUserPwd" DataPropertyName="UserPwd" />
            <Kevin:DataBindItem ControlID="txtUserName" DataPropertyName="UserName" />
            <Kevin:DataBindItem ControlID="txtUserSex" DataPropertyName="UserSex" />
            <Kevin:DataBindItem ControlID="txtUserPhone" DataPropertyName="UserPhone" />
            <Kevin:DataBindItem ControlID="txtUserAddress" DataPropertyName="UserAddress" />
            <Kevin:DataBindItem ControlID="txtUserEmail" DataPropertyName="UserEmail" />
            <Kevin:DataBindItem ControlID="txtUserState" DataPropertyName="UserState" />
            <Kevin:DataBindItem  ControlID="cns_CompanyID" DataPropertyName="CompanyID"  ControlPropertyName="Value" GetValueClientMethod="_getCodeNameSelectValues"/>
           <Kevin:DataBindItem  ControlID="cns_Roles" DataPropertyName="RoleID"  ControlPropertyName="Value" GetValueClientMethod="_getCodeNameSelectValues"/>
        </BindItems>
    </Kevin:DataBind>
    <script type="text/javascript">
        function userSetData(data) {
            document.getElementById("<%=txtUserID.ClientID %>").value = data.UserID;

            if (confirm("保存成功，是否关闭本页面？")) {
                $editPage.close();
            } else {
                $editPage.refresh();
            }
        }
        function delconfirm(data) {
            if (confirm("删除确认？\n用户：")) {
                $editPage.close();
                return true;
            } else {
                $editPage.refresh();
            }
            return false;
        }
        var user = Class.extend({
            refresh: function (data) {
                document.getElementById("<%=txtUserID.ClientID %>").value = data.UserID;
            }
        });
    </script>
</asp:Content>
